<<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
        <ui:composition template="./../Template/generalTemplate.xhtml">

            <ui:define name="content">


                <h:form>
                    <f:view beforePhase="#{displayPurchaseOrderManagedBean.initView}"> 
                        <p:panel header ="Sales Order Information" style="height:495px;">
                            <div style="margin-top:30px;margin-left:50px;margin-right:50px;height:380px;">
                                <h:panelGrid columns="2" cellpadding="2">
                                    <h:outputText value="Company Name:" /> 
                                    <h:outputText value="#{displayPurchaseOrderManagedBean.customer.name}" />
                                    <h:outputText value="Processed by (SalesMan)"/>
                                    <h:outputText value ="#{displayPurchaseOrderManagedBean.purchaseOrder.processedBy.name}"/>
                                    <h:outputText value= "Date Created"/>
                                    <h:outputText value= "#{displayPurchaseOrderManagedBean.purchaseOrder.dateCreated}"><f:convertDateTime pattern ="dd/MM/yyyy"/></h:outputText>
                                    <h:outputText value= "Total Amount"/>
                                    <h:outputText value= "#{displayPurchaseOrderManagedBean.purchaseOrder.totalAmount}"/>

                                </h:panelGrid>   

                                <p:dataTable dynamic="true" emptyMessage="No product selected" value="#{displayPurchaseOrderManagedBean.lineItemList}" var="t" style="margin-top:20px;" paginator="true" rows="5">

                                    <p:column>
                                        <f:facet name="header">Product Name</f:facet>
                                        #{t.product.productName}
                                    </p:column>   

                                    <p:column>
                                        <f:facet name="header">Quantity</f:facet>
                                        #{t.quantity}
                                    </p:column>

                                    <p:column>
                                        <f:facet name="header">Delivery Date</f:facet>
                                        <h:outputText value="#{t.deliveryDate}">
                                            <f:convertDateTime pattern ="dd/MM/yyyy"/>
                                        </h:outputText>    
                                    </p:column>

                                    <p:column>
                                        <f:facet name="header">Delivery Location</f:facet>
                                        #{t.deliveryLocation}
                                    </p:column> 

                                    <p:column>
                                        <f:facet name="header">Unit Price</f:facet>
                                        #{t.price}
                                    </p:column> 

                                    <p:column>
                                        <f:facet name="header">Total Price</f:facet>
                                        #{t.cumAmount}
                                    </p:column> 
                                </p:dataTable>


                            </div>
                            <div style="margin-left: 50px;">

                                <h:commandButton value ="Back" action ="#{displayPurchaseOrderManagedBean.reDirect}"/>
                            </div>
                        </p:panel>
                    </f:view>
                </h:form>       


            </ui:define>
            <ui:define name="bottom">
                <div id="msgbox">
                    <h:outputText value ="Inventory Has Been reserved "/>
                </div>
            </ui:define>
        </ui:composition>       
    </body>
</html>
